package com.test.action;

import java.util.Date;
import java.util.List;

/*import com.test.action.base.BaseAction;
import com.test.dao.model.paymentcenter.OrderForm;
import com.test.dao.model.paymentcenter.OrderList;
import com.test.dao.model.paymentcenter.UserPurview;
*/
public class AlipayNotify{

    private static final long serialVersionUID = 1L;
    private String buyer_email;
    private long buyer_id;
    private String exterface;
    private String is_success;
    private String notify_id;
    private String notify_time;
    private String notify_type;
    private String out_trade_no;
    private String payment_type;
    private String seller_email;
    private long seller_id;
    private String subject;
    private float total_fee;
    private String trade_no;
    private String trade_status;
    private String sign;
    private String sign_type;
    /*private OrderForm of;*/

    //……这里省去了get和set方法

    // 处理支付宝传过来的参数信息
    public String alipayTrade() throws Exception {

        if (this.is_success.equalsIgnoreCase("T")
                && "TRADE_SUCCESS".equalsIgnoreCase(this.trade_status)) {

            /*of = (OrderForm) orderFormService
                    .findOrderFormsByOut_trade_no(this.out_trade_no);

            if (of != null) {
                of.setTradeStatus(1);
                of.setTradeNo(this.trade_no);
                of.setNotifyTime(new Date());                
                orderFormService.updateOldModel(of); // 更新

                List<OrderList> orderList = orderListService
                        .findOrderFormsByOutTradeNo(this.out_trade_no);
                for (OrderList ol : orderList) {
                    //这里省去了处理订单逻辑代码……………………
                }
            }*/
            //回调成功之后，给支付宝返回一个 "success" 字符就可以了
            return "success";

        }

        return "failure";

    }
}
